home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / make / icmake-6.000 / icmake-6 / icmake / rss / makepath.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-08  |  1.4 KB  |  60 lines

  1. /*
  2.     makepath.c pwp 93 07 14
  3.     replacement function _makepath
  4.     for NON-MSDOS systems ONLY
  5.  
  6.     Arguments:
  7.         path:   buffer to contain the combined name; length _MAX_PATH
  8.                 this is NOT checked
  9.  
  10.         drive:  pointer to drive specifier; ignored
  11.         dir:    directory string, can be NULL or empty ("");
  12.                 if not-empty, may have a trailing DIRSEP character
  13.         fname:  basename string, can be NULL or empty ("")
  14.         ext:    extension string, can be NULL or empty ("");
  15.                 if not empty, can have optional leading dot
  16.  
  17. */
  18.  
  19. #ifndef MSDOS
  20.  
  21. #include <stdio.h>
  22. #include <string.h>
  23. #include "../icm.h"
  24. #include "icrss.h"
  25.  
  26. static char
  27.     dot[] = ".";
  28.  
  29. void _makepath(char * path,
  30.     const char * drive, const char * dir, const char * fname, const char * ext)
  31. {
  32.     path[0] = '\x0';                        /*  prepare for strcats */
  33.  
  34.     if (dir && dir[0])
  35.     {
  36.         strcat(path, dir);
  37.  
  38.         if (dir[strlen(dir) - 1] != DIRSEP)
  39.         {
  40.             unsigned short
  41.                 l;
  42.  
  43.             path[l = strlen(path)] = DIRSEP;
  44.             path[++l] = '\x0';              /*  make it an asciiz   */
  45.         }
  46.     }
  47.  
  48.     if (fname && fname[0])
  49.         strcat(path, fname);
  50.  
  51.     if (ext && ext[0])
  52.     {
  53.         if (ext[0] != dot[0])
  54.             strcat(path, dot);
  55.  
  56.         strcat(path, ext);
  57.     }
  58. }
  59. #endif  /*  MSDOS  */
  60.